// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sysin

import (
	"context"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/encoding/gjson"
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

// StockZtPoolUpdateFields 修改涨停表现字段过滤
type StockZtPoolUpdateFields struct {
	Code                 string      `json:"code"                 dc:"code"`
	Name                 string      `json:"name"                 dc:"name"`
	Turnover             float64     `json:"turnover"             dc:"成交额"`
	Date                 string      `json:"date"                 dc:"日期"`
	Desc                 string      `json:"desc"                 dc:"解读"`
	SellSeat             *gjson.Json `json:"sellSeat"             dc:"sell_seat"`
	BuySeat              *gjson.Json `json:"buySeat"              dc:"buy_seat"`
	LastPrice            float64     `json:"lastPrice"            dc:"最新价"`
	ChangePercent        float64     `json:"changePercent"        dc:"涨跌幅"`
	CirculatingMarketCap float64     `json:"circulatingMarketCap" dc:"流通市值"`
	MarketCap            float64     `json:"marketCap"            dc:"总市值"`
	TurnoverRate         float64     `json:"turnoverRate"         dc:"换手率"`
	Fbzj                 float64     `json:"fbzj"                 dc:"封板资金"`
	Zbcs                 int         `json:"zbcs"                 dc:"炸板次数"`
	LbNumber             int         `json:"lbNumber"             dc:"连板次数"`
	ZtStatisticsDays     int         `json:"ztStatisticsDays"     dc:"涨停统计-天数范围"`
	ZtStatisticsNum      int         `json:"ztStatisticsNum"      dc:"涨停统计-涨停天数"`
	Industry             string      `json:"industry"             dc:"所属行业"`
	FirstFbTime          *gtime.Time `json:"firstFbTime"          dc:"首次封板时间"`
	LastFbTime           *gtime.Time `json:"lastFbTime"           dc:"最后封板时间"`
}

// StockZtPoolInsertFields 新增涨停表现字段过滤
type StockZtPoolInsertFields struct {
	Code                 string      `json:"code"                 dc:"code"`
	Name                 string      `json:"name"                 dc:"name"`
	Turnover             float64     `json:"turnover"             dc:"成交额"`
	Date                 string      `json:"date"                 dc:"日期"`
	Desc                 string      `json:"desc"                 dc:"解读"`
	SellSeat             *gjson.Json `json:"sellSeat"             dc:"sell_seat"`
	BuySeat              *gjson.Json `json:"buySeat"              dc:"buy_seat"`
	LastPrice            float64     `json:"lastPrice"            dc:"最新价"`
	ChangePercent        float64     `json:"changePercent"        dc:"涨跌幅"`
	CirculatingMarketCap float64     `json:"circulatingMarketCap" dc:"流通市值"`
	MarketCap            float64     `json:"marketCap"            dc:"总市值"`
	TurnoverRate         float64     `json:"turnoverRate"         dc:"换手率"`
	Fbzj                 float64     `json:"fbzj"                 dc:"封板资金"`
	Zbcs                 int         `json:"zbcs"                 dc:"炸板次数"`
	LbNumber             int         `json:"lbNumber"             dc:"连板次数"`
	ZtStatisticsDays     int         `json:"ztStatisticsDays"     dc:"涨停统计-天数范围"`
	ZtStatisticsNum      int         `json:"ztStatisticsNum"      dc:"涨停统计-涨停天数"`
	Industry             string      `json:"industry"             dc:"所属行业"`
	FirstFbTime          *gtime.Time `json:"firstFbTime"          dc:"首次封板时间"`
	LastFbTime           *gtime.Time `json:"lastFbTime"           dc:"最后封板时间"`
}

// StockZtPoolEditInp 修改/新增涨停表现
type StockZtPoolEditInp struct {
	entity.StockZtPool
}

func (in *StockZtPoolEditInp) Filter(ctx context.Context) (err error) {
	// 验证code
	if err := g.Validator().Rules("required").Data(in.Code).Messages("code不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证成交额
	if err := g.Validator().Rules("required").Data(in.Turnover).Messages("成交额不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证日期
	if err := g.Validator().Rules("required").Data(in.Date).Messages("日期不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	return
}

type StockZtPoolEditModel struct{}

// StockZtPoolDeleteInp 删除涨停表现
type StockZtPoolDeleteInp struct {
	Date string `json:"date"`
}

func (in *StockZtPoolDeleteInp) Filter(ctx context.Context) (err error) {
	return
}

type StockZtPoolDeleteModel struct{}

// StockZtPoolViewInp 获取指定涨停表现信息
type StockZtPoolViewInp struct {
	Id int `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *StockZtPoolViewInp) Filter(ctx context.Context) (err error) {
	return
}

type StockZtPoolViewModel struct {
	entity.StockZtPool
}

// StockZtPoolListInp 获取涨停表现列表
type StockZtPoolListInp struct {
	form.PageReq
	Date string `json:"date"      dc:"日期"`
	Type int    `json:"type"      dc:"1 涨停 2 昨日涨停 3 跌停"`
}

func (in *StockZtPoolListInp) Filter(ctx context.Context) (err error) {
	return
}

type StockZtPoolListModel struct {
	Id                   int         `json:"id"                   dc:"id"`
	Code                 string      `json:"code"                 dc:"code"`
	Name                 string      `json:"name"                 dc:"name"`
	Turnover             float64     `json:"turnover"             dc:"成交额"`
	Date                 string      `json:"date"                 dc:"日期"`
	Desc                 string      `json:"desc"                 dc:"解读"`
	LastPrice            float64     `json:"lastPrice"            dc:"最新价"`
	ChangePercent        float64     `json:"changePercent"        dc:"涨跌幅"`
	CirculatingMarketCap float64     `json:"circulatingMarketCap" dc:"流通市值"`
	MarketCap            float64     `json:"marketCap"            dc:"总市值"`
	TurnoverRate         float64     `json:"turnoverRate"         dc:"换手率"`
	Fbzj                 float64     `json:"fbzj"                 dc:"封板资金"`
	Zbcs                 int         `json:"zbcs"                 dc:"炸板次数"`
	LbNumber             int         `json:"lbNumber"             dc:"连板次数"`
	ZtStatisticsDays     int         `json:"ztStatisticsDays"     dc:"涨停统计-天数范围"`
	ZtStatisticsNum      int         `json:"ztStatisticsNum"      dc:"涨停统计-涨停天数"`
	Industry             string      `json:"industry"             dc:"所属行业"`
	FirstFbTime          *gtime.Time `json:"firstFbTime"          dc:"首次封板时间"`
	LastFbTime           *gtime.Time `json:"lastFbTime"           dc:"最后封板时间"`
}

// StockZtPoolExportModel 导出涨停表现
type StockZtPoolExportModel struct {
	Id                   int         `json:"id"                   dc:"id"`
	Code                 string      `json:"code"                 dc:"code"`
	Name                 string      `json:"name"                 dc:"name"`
	Turnover             float64     `json:"turnover"             dc:"成交额"`
	Date                 string      `json:"date"                 dc:"日期"`
	Desc                 string      `json:"desc"                 dc:"解读"`
	LastPrice            float64     `json:"lastPrice"            dc:"最新价"`
	ChangePercent        float64     `json:"changePercent"        dc:"涨跌幅"`
	CirculatingMarketCap float64     `json:"circulatingMarketCap" dc:"流通市值"`
	MarketCap            float64     `json:"marketCap"            dc:"总市值"`
	TurnoverRate         float64     `json:"turnoverRate"         dc:"换手率"`
	Fbzj                 float64     `json:"fbzj"                 dc:"封板资金"`
	Zbcs                 int         `json:"zbcs"                 dc:"炸板次数"`
	LbNumber             int         `json:"lbNumber"             dc:"连板次数"`
	ZtStatisticsDays     int         `json:"ztStatisticsDays"     dc:"涨停统计-天数范围"`
	ZtStatisticsNum      int         `json:"ztStatisticsNum"      dc:"涨停统计-涨停天数"`
	Industry             string      `json:"industry"             dc:"所属行业"`
	FirstFbTime          *gtime.Time `json:"firstFbTime"          dc:"首次封板时间"`
	LastFbTime           *gtime.Time `json:"lastFbTime"           dc:"最后封板时间"`
}
